<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<jsp:include page="common/css_js.jsp"></jsp:include>
<%
    String path = request.getContextPath();
%>
<html>
<head>
    <title>Title</title>
</head>
<body>
<div class="container">
<form  onsubmit="return false;">
    订单id:<input class="form-control" type="text" name="o_id" id="o_id" value="${Order.o_Id}" readonly><br>
    顾客id:<input class="form-control" type="text" name="c_id" id="c_id" value="${Order.c_Id}" readonly><br>
    员工id:<input class="form-control" type="text" name="e_id" id="e_id" value="${Order.e_Id}" readonly><br>
    座位id:<input class="form-control" type="text" name="s_id" id="s_id" value="${Order.s_Id}" readonly><br>
    订单生成时间:<input class="form-control" type="text" name="ordertime" id="ordertime" value="${Order.order_Time}" readonly><br>
    取餐方式:<input class="form-control" type="text" name="o_method" id="o_method" value="${Order.o_Method}" readonly><br>
    订单状态:<input class="form-control" type="text" name="o_state" id="o_state" value="${Order.o_State}"><br>
    <div>0:接受订单 1:正在做菜 2:正在配送 3:配送完成</div>
    <button class="btn btn-success" type="button" onclick="updateOrder(${Order.o_Id})">提交</button>
</form>
</div>
</body>
<script src="<%=path%>/static/jquery/jquery-3.6.0.min.js"></script>
<script>
    function updateOrder(o_id) {
        $.ajax({
                url:"updateOrder",
                method:"post",
                dataType: "text",
                /*contentType:"application/x-www.-form-urlencoded",*/
                data:{
                    o_id:o_id,
                    o_state:$("#o_state").val()
                },
                success:function (result) {
                    if(result == "success"){
                        alert("修改成功");
                        //刷新父层
                        parent.location.reload();
                        //关闭本层
                        layer_close();
                    }else {
                        alert("修改失败");
                    }
                },error:function (e) {
                    alert("服务器错误");
                }
            })
    }
</script>
</html>
